#DEFINES += KPEXT_GENLIBDLL

contains(DEFINES,KPEXT_GENLIBDLL){
    TEMPLATE = lib
    CONFIG += dll
#    unix:CONFIG += shared
} else {
    TEMPLATE = app
    CONFIG += console
    DEFINES += KPEXT_BARE_SRC
    DEFINES += KPEXT_DEV_MAIN
#    DEFINES += KPEXT_USE_KOMPUTE
}


CONFIG += c++11
CONFIG -= app_bundle
CONFIG -= qt

include(../glm.pri)
include(../vulkan.pri)
include(../fmt.pri)
include(../spdlog.pri)

contains(DEFINES, KPEXT_USE_KOMPUTE){

include(../kompute.pri)

} else {
SPDLOG_LEVEL_TRACE = 0
SPDLOG_LEVEL_DEBUG = 1
SPDLOG_LEVEL_INFO = 2
SPDLOG_LEVEL_WARN = 3
SPDLOG_LEVEL_ERROR = 4
SPDLOG_LEVEL_CRITICAL = 5
SPDLOG_LEVEL_OFF = 6

CONFIG(debug, debug|release){

DEFINES +=  DEBUG \  # 这个定义是用来默认打开vulkan验证层
            SPDLOG_ACTIVE_LEVEL=$$SPDLOG_LEVEL_DEBUG \ #spdlog编译宏函数级别，小于设定级别不编译


}else{

DEFINES += SPDLOG_ACTIVE_LEVEL=$$SPDLOG_LEVEL_WARN \

} # CONFIG(debug, debug|release)

} # contains(DEFINES, KPEXT_USE_KOMPUTE)
include(../nlohmann-json.pri)

HEADERS += \
    KpExtGP.h \
    KpExtGP.h \  # spdlog_custom.h
    kpextBaseCompute.h \
    kpextCommandBuffer.h \
    kpextCommonDef.h \
    kpextComputePipeline.h \
    kpextDescriptorMgr.h \
    kpextMemoryResource.h \
\#    kpextOpImgCpyF32C1.h \
\#    kpextOpImgCvtF32C1toF32C2.h \
    kpextSpvData.h \
    kpextSyncMisc.h \
    kpextVkContext.h


SOURCES += \
    KpExtGP.cpp \
    kpextBaseBuffer.cpp \
    kpextBaseCompute.cpp \
    kpextCommandBuffer.cpp \
    kpextComputePipeline.cpp \
    kpextConstDef.cpp \
    kpextDescriptorPool.cpp \
\#    kpextOpImgCpyF32C1.cpp \
\#    kpextOpImgCvtF32C1toF32C2.cpp \
    kpextRawBuffer.cpp \
    kpextRawDeviceMemory.cpp \
    kpextStagingBuffer.cpp \
    kpextSyncMisc.cpp \
    kpextVkContext.cpp \
    spdlog_custom.cpp \
    kpextSpvData.cpp


contains(DEFINES,KPEXT_GENLIBDLL){

} else {

SOURCES += \
    main.cpp


}

ProjectName = KpExt_GP
LibsBuildDir = libs-build

CONFIG(debug, debug|release){
  DESTDIR = $${PWD}/../$${LibsBuildDir}/debug
  copy_libs_dest.path = $${PWD}/../../Build-$${ProjectName}/debug
  final_intall.path = $${PWD}/../../Build-$${ProjectName}/Install/debug
}else{
  DESTDIR = $${PWD}/../$${LibsBuildDir}/release
  copy_libs_dest.path = $${PWD}/../../Build-$${ProjectName}/release
  final_intall.path = $${PWD}/../../Build-$${ProjectName}/Install/release
}

OBJECTS_DIR = $${DESTDIR}/tmp/$${TARGET}
MOC_DIR = $${DESTDIR}/moc/$${TARGET}
RCC_DIR = $${DESTDIR}/rcc/$${TARGET}
UI_DIR = $${DESTDIR}/ui/$${TARGET}

win32{
!build_pass{
system(pushd $$system_path("$${PWD}/../glslsrc/") && $$system_path("$${PWD}/../glslsrc/gen_spirv_src.exe") && popd)
system(copy /Y $$system_path("$${PWD}/../glslsrc/kpextSpvData.h") $$system_path("$${PWD}/"))
system(copy /Y $$system_path("$${PWD}/../glslsrc/kpextSpvData.cpp") $$system_path("$${PWD}/"))
system(pushd $$system_path("$${PWD}/..") && git status && popd)

}


copy_libs_dest.files = '$${DESTDIR}/$${TARGET}.dll'
final_intall.files = $$copy_libs_dest.files
#message($$final_intall.path)
#message($$final_intall.files)
INSTALLS += copy_libs_dest \
#            export_include_install \
#    final_intall \

}
